﻿@model SaleWebsite.Models.Product

@{
    ViewBag.Title = "insert";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using(Html.BeginForm("insert","Product",FormMethod.Post))
{
  @Html.ValidationSummary()
  <h2>Thông tin mặt hàng</h2>
  @Html.DisplayNameFor(m=>m.Name)
  @Html.EditorFor(m=>m.Name)
  
   @Html.DisplayNameFor(m=>m.Image)<br />
   
    if (Model == null||Model.Image==null)
    {
        <img src="@Url.Content("~/Content/themes/base/images/choose.png")" style="width:100px;height:100px;" id="choose" /><br />
    }
    else
    {
        <img src="@Model.Image" style="width:100px;height:100px;" id="choose" /><br />
    }
   
    
 
    <input type=hidden name ="Image" value="" />
  @Html.DisplayNameFor(m => m.Price1)
  @Html.EditorFor(m => m.Price1)
  <!--<input type=number min=0 name ="Price1" />-->
  @Html.DisplayNameFor(m => m.Price2)
  <!--<input type=number min=0 name ="Price2" />-->
    @Html.EditorFor(m => m.Price2)
    @Html.DisplayNameFor(m => m.Is_Promotion)
    <
    <input name="Is_promotion" placeholder="" type=number min=0 max=1 />
    @Html.DisplayNameFor(m => m.Vat)
    @Html.EditorFor(m => m.Vat)
    @Html.DisplayNameFor(m => m.Product_from)
    @Html.EditorFor(m => m.Product_from)
    @Html.DisplayNameFor(m => m.Id_donvitinh)
    @Html.DropDownListFor(m => m.Id_donvitinh, SaleWebsite.Models.Donvitinh.GetAllSelect(@Model == null ? 0 : @Model.Id_donvitinh))
    @Html.DisplayNameFor(m => m.Factory)
    @Html.EditorFor(m => m.Factory)
    @Html.DisplayNameFor(m => m.Description)
    @Html.EditorFor(m => m.Description)
    
    @Html.DisplayNameFor(m => m.Product_type)
    
    @Html.DropDownListFor(m => m.Product_type, SaleWebsite.Models.Product_Type.GetAllSelect(@Model == null ? 0 : @Model.Product_type))
    <input type=submit value=Insert />
    
}
<div id ="list_images" style="display:none;width:1000px;height:700px;">
<form action="/Image/UploadFiles" id="myForm"  method="post" enctype="multipart/form-data">

   <h2>Quản lí thông tin  hình ảnh</h2>
 <input type=text name="Name" placeholder="Tên sản phẩm" />
 <input type="file" name="image" id="Image" />
 
 <input type=submit value="Insert" />
 <table>
 <div id="list_items">
 <img src="" style="width:100px;height:100px;float:left;margin-right:10px;margin-top:5px;" />
 </div>
 </table>
</form>

</div>

<script src="http://malsup.github.com/jquery.form.js"></script> 
@Scripts.Render("~/bundles/product_insert")
